<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
//不读取缓存页面。强制浏览器重新访问服务器下载页面。
/* response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("Expires", 0); */

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>内容输入/编辑</title>
<base href="${basePath}"/>
<style type="text/css">
body {font-family: Arial, Helvetica, sans-serif; font-size:12px; text-align:center;}
a { text-decoration: none;}
#all {widht:100%; text-align:center; margin:auto;height:99%;overflow:hidden; border: 0px solid #FF0000;}
#main {width: 96%; line-height: 1.8; margin:auto; border:1px #ccc dashed; text-align: left; text-indent: 2em;}

.hr0{ height:1px;border:none;border-top:1px dashed #1E90FF;}

#all .s{float:left;text-align:left;width:200px}
#all .sh{width:200px}
#all .s .st{padding-left:10px;margin-top:5px}
#all .s .sth{padding-left:10px}
#all .s .stht{padding-left:10px;font-weight:bold}
#all .a{float:left;width:1000px;text-align:left}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="javascript/ajaxfileupload.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript">
jQuery(function($){
	CKEDITOR.replace('content',{
		language : 'zh-cn',//简体中文   
		width : "99%", //宽度
		height :"390", //高度
		//工具栏是否可以被收缩,bug：收缩后宽度会变化
		//toolbarCanCollapse:true, 
		toolbar : //工具栏设置               随便取舍
		[
				[ 'Source', 'Maximize', '-', 'Save', 'NewPage',
						'Preview', '-', 'Templates' ],
				[ 'Cut', 'Copy', 'Paste', 'PasteText',
						'PasteFromWord' ],
				[ 'Undo', 'Redo', '-', 'Find', 'Replace', '-', ,
						'Table', 'HorizontalRule', '-',
						'SelectAll', 'RemoveFormat' ],
				'/',
				[ 'Bold', 'Italic', 'Underline', 'Strike', '-',
						'Subscript', 'Superscript' ],
				[ 'NumberedList', 'BulletedList', '-', 'Outdent',
						'Indent', 'Blockquote' ],
				[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
						'JustifyBlock' ],
				[ 'Link', 'Unlink', 'Anchor' ],
				[ 'Image', 'Flash', 'Smiley', 'SpecialChar',
						'PageBreak' ],
				[ 'Styles', 'Format', 'Font', 'FontSize' ],
				[ 'TextColor', 'BGColor' ] ]
	});
	
	CKEDITOR.replace('precontent',{
		language : 'zh-cn',//简体中文   
		width : "99%", //宽度
		height :"200", //高度
		//工具栏是否可以被收缩,bug：收缩后宽度会变化
		//toolbarCanCollapse:true, 
		toolbar : //工具栏设置               随便取舍
		[
				[ 'Source', 'Maximize', '-', 'Save', 'NewPage',
						'Preview', '-', 'Templates' ],
				[ 'Cut', 'Copy', 'Paste', 'PasteText',
						'PasteFromWord' ],
				[ 'Undo', 'Redo', '-', 'Find', 'Replace', '-', ,
						'Table', 'HorizontalRule', '-',
						'SelectAll', 'RemoveFormat' ],
				'/',
				[ 'Bold', 'Italic', 'Underline', 'Strike', '-',
						'Subscript', 'Superscript' ],
				[ 'NumberedList', 'BulletedList', '-', 'Outdent',
						'Indent', 'Blockquote' ],
				[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight',
						'JustifyBlock' ],
				[ 'Link', 'Unlink', 'Anchor' ],
				[ 'Image', 'Flash', 'Smiley', 'SpecialChar',
						'PageBreak' ],
				[ 'Styles', 'Format', 'Font', 'FontSize' ],
				[ 'TextColor', 'BGColor' ] ]
	});
	
});


function ajaxFileUpload() {
	$("#loading").ajaxStart(function() {
		$(this).show();
	})//开始上传文件时显示一个图片
	.ajaxComplete(function() {
		$(this).hide();
	});//文件上传完成将图片隐藏起来

	$.ajaxFileUpload({
		url : 'content/upload.htm',//用于文件上传的服务器端请求地址
		secureuri : false,//一般设置为false
		fileElementId : 'file',//文件上传空间的id属性  <input type="file" id="file" name="file" />
		dataType : 'json',//返回值类型 一般设置为json
		success : function(data, status) //服务器成功响应处理函数
		{
			alert(data.message);//从服务器返回的json中取出message中的数据,其中message为在struts2中action中定义的成员变量
			if (typeof (data.error) != 'undefined') {
				if (data.error != '') {
					alert(data.error);
				} else {
					alert(data.message);
				}
			}
		},
		error : function(data, status, e)//服务器响应失败处理函数
		{
			alert(e);
		}
	});
	return false;
}
</script>
</head>
<body>

<div id="all">
<div class="s">
	<div class="sh"><a href="content/lang.htm?action=1">添加地域</a></div>
	<c:if test="${not empty langpro}">
		<c:forEach items="${langpro}" var="lp" varStatus="status">
			<div class="so"><a href="content/lang.htm?action=2&&pageid=${lp.id}">${lp.name}</a></div>
				<c:if test="${not empty lp.underlist}">
					<c:forEach items="${lp.underlist}" var="lpu" varStatus="statu">
					<div class="st"><a href="content/lang.htm?action=3&&pageid=${lpu.id}">${lpu.name}</a></div>
					<c:if test="${not empty lpu.top}">
						<div class="stht">顶头导航栏</div>
						<c:forEach items="${lpu.top}" var="lput" varStatus="stat">
							<div class="sth"><a href="content/lang.htm?action=4&&pageid=${lput.id}">${lput.title}</a></div>
						</c:forEach>
					</c:if>
					<c:if test="${not empty lpu.bottom}">
						<div class="stht">尾部友情连接</div>
						<c:forEach items="${lpu.bottom}" var="lpub" varStatus="sta">
							<div class="sth"><a href="content/lang.htm?action=4&&pageid=${lpub.id}">${lpub.title}</a></div>
						</c:forEach>
					</c:if>
					</c:forEach>
				</c:if>
		</c:forEach>
	</c:if>
</div>
<c:if test="${not empty tip}">
<div class="a">
	<div class="tip">${tip}</div>
	<form action="content/langsubmit.htm" method="post">
		<input type="hidden" name="action" id="action" value="${action}">
		<input type="hidden" name="pageid" id="pageid" value="${pageid}">
		<c:if test="${not empty cw}"><input type="hidden" name="typeId" id="typeId" value="${cw.typeId}"></c:if>
		<c:if test="${empty cw}"><c:if test="${action==3}">上部连接<input type="radio" name="typeId" value="4" checked>下部连接<input type="radio" name="typeId" value="5"></c:if></c:if>
		请输入您所需要的标题:<input type="text" name="titlelang"id="titlelang" value="${cw.title}">
		<c:if test="${action ==3}"><textarea id="content" name="content" rows="60" cols="50" style="height:99%;"></textarea><!--  --></c:if>
		<c:if test="${action ==4}"><textarea id="content" name="content" rows="60" cols="50" style="height:99%;">${cw.content}</textarea><!--  --></c:if>
		<input type="submit" value="提交">
	</form>
</div>
</c:if>
</div>
</body>
</html>